using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using System.Data;
using Sinacor.Infra.Service.Data;
using Sinacor.Infra.Service.Security.Authorization;
using Sinacor.Infra.Service.Common;

namespace Sinacor.Servico.Bovespa.Corretagem.ResourceAccess
{

    /// <summary>
    /// Business Logic TipoAplicacao
    /// </summary>
    public class TipoAplicacao : BaseResourceAccess
    {
        #region Construtor

        /// <summary>
        /// Construtor padrão
        /// </summary>
        public TipoAplicacao()
            : base()
        {
        }

        #endregion


        #region ConsultarTipoAplicacao
        /// <summary>
        /// Método ConsultarTipoAplicacao
        /// </summary>
        public List<BusinessEntity.TipoAplicacao> ConsultarTipoAplicacao()
        {
            List<BusinessEntity.TipoAplicacao> response = null;
            StringBuilder sql = new StringBuilder();

            sql.Append(@"select CD_TIPO_APLIC,
							DS_TIPO_APLIC 
							from tbocorr_tipo_aplic");

            using (DbCommand command = this.DataBase.GetSqlStringCommand(sql.ToString()))
            {

                response = this.FindAll<BusinessEntity.TipoAplicacao>(command, new ConstructEntity<BusinessEntity.TipoAplicacao>(ConstrutorConsultarTipoAplicacao));
            }

            return response;
        }

        #endregion

        #region ConstrutorConsultarTipoAplicacao
        protected BusinessEntity.TipoAplicacao ConstrutorConsultarTipoAplicacao(IDataReader reader)
        {
            BusinessEntity.TipoAplicacao entity = new BusinessEntity.TipoAplicacao();

            entity.Codigo = reader.GetValue<System.Int32>("CD_TIPO_APLIC");
            entity.Descricao = reader.GetValue<System.String>("DS_TIPO_APLIC");

            return entity;
        }
        #endregion

    }
}



